package com.winchain.chainbill.basic.invoice.controller;

import com.shell.bee.base.annotation.Logging;
import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.entity.mvc.RetMsg;
import com.shell.bee.mvc.controller.BaseController;
import com.shell.bee.persistence.model.PageLimit;
import com.winchain.chainbill.basic.invoice.service.InvoiceDeferedService;
import com.winchain.chainbill.basic.invoice.vo.InvoiceDeferedVo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class InvoiceDeferedController extends BaseController {
	@Autowired
	private InvoiceDeferedService invoiceDeferedService;

	@RequestMapping
	@Logging(module = "��������", methods = "����������������������")
	public List<InvoiceDeferedVo> selectInvoiceByPage(PageLimit limit, InvoiceDeferedVo invoiceDeferedVo)
			throws Exception {
		return this.invoiceDeferedService.selectInvoiceByPage(limit, invoiceDeferedVo);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "��������")
	public RetMsg pass(String bizId, String bizType) throws Exception {
		String result = this.invoiceDeferedService.pass(bizId, bizType);
		if (StringUtil.emptyAndNull(result)) {
			return new RetMsg("success", "��������������");
		}
		return new RetMsg("error", "��������������");
	}

	@RequestMapping
	@Logging(module = "��������", methods = "��������")
	public RetMsg reject(String bizId, String bizType, String remark) throws Exception {
		String result = this.invoiceDeferedService.reject(bizId, bizType, remark);
		if (StringUtil.emptyAndNull(result)) {
			return new RetMsg("success", "��������������");
		}
		return new RetMsg("error", "��������������" + result);
	}
}
